package com.ccc3gc.listener;

import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpSessionAttributeListener;
import javax.servlet.http.HttpSessionBindingEvent;

@WebListener
public class SessionAttrListener implements HttpSessionAttributeListener {
    @Override
    public void attributeAdded(HttpSessionBindingEvent event) {
        System.out.print("session ID：" + event.getSession().getId());
        System.out.println(" 添加属性：" + event.getName()
                + ",属性值是：" + event.getValue());
    }

    @Override
    public void attributeRemoved(HttpSessionBindingEvent event) {
        System.out.print("session ID：" + event.getSession().getId());
        System.out.println(" 删除属性：" + event.getName()
                + ",属性值是：" + event.getValue());
    }

    @Override
    public void attributeReplaced(HttpSessionBindingEvent event) {
        System.out.print("session ID：" + event.getSession().getId());
        System.out.println(" 覆盖属性：" + event.getName()
                + ",属性值是：" + event.getValue());
    }
}
